package com.homework.wokr05;

public class Animal01 {
    String name ;
    public Animal01(String name) {
        this.name = name;
    }
    public void eat(String food){
        System.out.println("吃的是："+food);
    }
}
// Tiger类继承父类Animal
class Tiger01 extends Animal01{
    public Tiger01(String name) {
        super(name);
    }

    //在方法中调用父类引用的属性和方法
    public void test(){
        System.out.println(name);
        //直接调用父类引用属性
        System.out.println(super.name);
        // 直接调用父类引用方法
        super.eat("肉");
    }

    /*程序入口*/
    public static void main(String[] args) {
        Tiger01 tiger = new Tiger01("老虎");
        tiger.test();
    }
}
